//begin of script
//
var base_time=1000;
var up;
var sec1=0;
var sec2=0;
var min1=0;
var min2=0;
var timer_pv=0;
var timer_sp=0; //in secs
//
//
//
//
function up_count() {
if(power_state==1 & start_state==1 ) {
if(sec1==9) {
  sec1=0;
  up_sec2();
}
else sec1++;
get_time();
dsp_pv();
sp_pv();
sec_clock();
}
}
//
//sec2 side
function up_sec2() {
if(sec2==5) {
   sec2=0;
   up_min1();
}
else sec2++;
}
//
// min1
function up_min1() {
if(min1==9) {
   min1=0;
   up_min2();
}
else min1++;
}
//
//min2
function up_min2() {
if(min2==9) {
   min2=0;
}
else  min2++;
}
//
//1 Sec Clock timer
function sec_clock() {
document.images.colon_sec.src = colon_1.src;
up=setTimeout("colon_off();",(base_time/2));
}
function colon_off() {
document.images.colon_sec.src = colon_0.src;
up=setTimeout("up_count();",(base_time/2));
}

//end sec clock
//
//display pv
function dsp_pv() {
document.images.pvdsp1.src = "pngs/seg_" + sec1 + ".png";
document.images.pvdsp2.src = "pngs/seg_" + sec2 + ".png";
document.images.pvdsp3.src = "pngs/seg_" + min1 + ".png";
document.images.pvdsp4.src = "pngs/seg_" + min2 + ".png";
createCookie('digitaltimer1delabs2pv1',sec1,999);
createCookie('digitaltimer1delabs2pv2',sec2,999);
createCookie('digitaltimer1delabs2pv3',min1,999);
createCookie('digitaltimer1delabs2pv4',min2,999);
createCookie('digitaltimer1delabs2ms1',msec_now,999);
}
//compares set point and process value
function sp_pv() {
timer_pv = (min2 * 600) + (min1 * 60) + (sec2 * 10) + (sec1 * 1); //secs
timer_sp = (sp_4 * 600) + (sp_3 * 60) + (sp_2 * 10) + (sp_1 * 1); //secs
if (timer_pv == timer_sp){
set_red();
}
}
//
//end of script
